<template>
  <div class="not_found">
    <a-result status="404" title="404" :sub-title="`Sorry, the page you visited does not exist.${time}秒后退出该页面`">
    <template #extra>
      <a-button type="primary" @click="() => $router.back()">
        Back Home
      </a-button>
    </template>
  </a-result>
  </div>
</template>
<script>

export default {
  name: 'NotFound',
  components: {},
  data () {
    return {
      interval: null,
      time: 5
    }
  },
  watch: {

  },
  created () {

  },
  mounted () {
    this.back()
  },
  methods: {
    // 自动回退页面
    back () {
      if (this.interval) {
        clearInterval(this.interval)
      }
      this.interval = setInterval(() => {
        if (this.time > 1) {
          --this.time
        } else {
          this.$router.back()
        }
      }, 1000)
    }
  },
  beforeDestroy () {
    if (this.interval) {
      clearInterval(this.interval)
    }
  }
}
</script>
<style lang='scss' scoped>
</style>
